<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>注册详情</title>
    <link rel="stylesheet" href="../../layui/css/layui.css"/>
    <link rel="stylesheet" href="../../css/pages.css"/>
    <link rel="stylesheet" href="../../fonts/iconfont.css">
</head>
<body>
<div id="container">
    <div class="title">注册明细<span class="iconfont icon-guanbi goBack" onClick="javascript:history.go(-1);" ></span></div>

    <div id="app_a" style="display: inline-block;">

        <table class="layui-table" lay-even="" lay-skin="row">
            <thead>
            <tr>
                <th>微信号</th>
                <th>手机号</th>
                <th>注册时间</th>
                <th>最近登录时间</th>
                <th>余额</th>
                <th>省名</th>
                <th>市名</th>
                <th>区名</th>
                <th>小区名称</th>
                <th>幢名</th>
                <th>单元名</th>
                <th>楼层</th>
            </tr>
            </thead>
            <tbody class="org-table">
            </tbody>
        </table>
        <div id="page-fen">
            <div id="page-num"></div>
        </div>
    </div>
</div>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/lift.js"></script>
<script>
    layui.use(['jquery','form','layer','laypage'], function(){
        var  $ = layui.jquery;
        layer = layui.layer;
        var laypage = layui.laypage;

        var user_id =localStorage.getItem("user_id");
        console.log(user_id);
        var pages ={};
        //乘梯
        searchReg();
        function searchReg(){
            $.ajax({
                url: '../../../dataCollection/getYesterdayNewReg',
                type: 'get',
                dataType: 'json',
                data:{
                    wuye_id:user_id,
                    current_page:1,
                    limit:10
                }
            })
                .done(function(response){
                    console.log("getlist",response);

                    if(response.resultCode == '200'){
                        var str= '';
                        console.log(response.page.list.length);

                        if(response.page.list.length){
                            for(var i=0;i<response.page.list.length;i++){
                                str +=
                                    '<tr>'+
                                    '<td>'+ response.page.list[i].wx_id +'</td>'+
                                    '<td>'+ response.page.list[i].telphone +'</td>'+
                                    '<td>'+ response.page.list[i].input_time+'</td>'+
                                    '<td>'+ response.page.list[i].last_login_time+'</td>'+
                                    '<td>'+ response.page.list[i].balance+'</td>'+
                                    '<td>'+ response.page.list[i].province_name+'</td>'+
                                    '<td>'+ response.page.list[i].city_name+'</td>'+
                                    '<td>'+ response.page.list[i].district_name+'</td>'+
                                    '<td>'+ response.page.list[i].building_name+'</td>'+
                                    '<td>'+ response.page.list[i].zhuang_name+'</td>'+
                                    '<td>'+ response.page.list[i].danyuan_name+'</td>'+
                                    '<td>'+ response.page.list[i].loucen+'</td>'+
                                    '</tr>'
                            }
                            $(".org-table").html(str);

                            //分页显示
                            pages.total = response.page.total;
                            console.log("总条数",pages.total);

                            pages.current_page = response.page.current_page;
                            console.log("当前页",pages.current_page);

                            pages.totalPages = Math.ceil(pages.total/10);
                            console.log("总页数",pages.totalPages);

                            laypage({
                                cont: 'page-num'
                                ,pages: pages.totalPages
                                ,curr: pages.current_page
                                ,first: 1
                                ,last:false
                                ,prev: '<em><</em>'
                                ,next: '<em>></em>'
                                ,jump: function(obj, first){ //触发分页后的回调
                                    var curr = obj.curr;
                                    console.log(curr);
                                    if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                        searchReg(curr);
                                    }
                                }
                            });
                        }else{
                            str = '<tr><td colspan="12">暂无数据</td></tr>';
                            $(".org-table").html(str);
                        }
                    }
                })
                .fail(function(response){
                    console.log("fail",response);
                    if(response.resultCode=='001'){
                        console.log("param is not found");
                    }
                });
        }
    });
</script>
</body>
